package net.asfun.jvalog.vo;

import net.asfun.jvalog.entity.Map;
import net.asfun.jvalog.entity.Web;
import net.asfun.jvalog.resource.MapDao;
import net.asfun.jvalog.resource.WebDao;

public class Blog{
	
	private Web web;
	private Map tme;
	private Map kws;
	private Map bas;
	private Map ver;
	
	private Blog(){};
	
	public static Blog info() {
		Blog myblog = new Blog();
		myblog.web = WebDao.getMySite();		
		myblog.tme = MapDao.getOrSaveByName(Config.TYPE_BLOG, "theme", "default"); 
		myblog.bas = MapDao.getOrSaveByName(Config.TYPE_BLOG, "base", "http://jvalog.appspot.com");
		myblog.kws = MapDao.getOrSaveByName(Config.TYPE_BLOG, "keywords", "java,appengine,gae,jdo,blog");
		myblog.ver = MapDao.getOrSaveByName(Config.TYPE_BLOG, "version", "0.29");
		return myblog;
	}

	public void setTheme(String theme) {
		this.tme.setValue(theme);
	}

	public void setKeywords(String keywords) {
		this.kws.setValue(keywords);
	}

	public void setBase(String base) {
		this.bas.setValue(base);
	}

	public void setVersion(String version) {
		this.ver.setValue(version);
	}

	public String getTitle() {
		return web.getTitle();
	}
	
	public void setTitle(String title) {
		web.setTitle(title);
	}
	
	public String getSubtitle() {
		return web.getSubtitle();
	}
	
	public void setSubtitle(String subtitle) {
		web.setSubtitle(subtitle);
	}
	
	public String getDescription() {
		return web.getDescription();
	}
	
	public void setDescription(String description) {
		web.setDescription(description);
	}
	
	public void setUrl(String url) {
		web.setUrl(url);
	}
	
	public String getUrl() {
		return web.getUrl();
	}
	
	public String getTheme() {
		return tme.getValue();
	}

	public String getKeywords() {
		return kws.getValue();
	}
	
	public String getVersion() {
		return ver.getValue();
	}

	public String getBase() {
		return bas.getValue();
	}
	
}
